package top.ucat.x.system.service.provider;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import top.ucat.x.system.entity.SysRolePermission;
import top.ucat.x.system.entity.SysUser;
import top.ucat.x.system.service.management.SysRolePermissionService;
import top.ucat.x.system.service.management.SysUserRoleService;
import top.ucat.x.system.service.management.SysUserService;

import java.util.Set;

/**
 * @Auther: Jun
 * @Date: 2020/4/3 13:37
 * @Description:
 */
@Service
public class SystemUserServiceImpl implements SystemUserService {

    @Autowired
    private SysUserRoleService sysUserRoleService;

    @Autowired
    private SysRolePermissionService sysRolePermissionService;


    @Autowired
    private SysUserService sysUserService;

    @Override
    public SysUser getUserByUserCode(String userCode) {
        SysUser user = sysUserService.getUserByUserCode(userCode);
        return user;
    }

    @Override
    public Set<String> getUserPermissionCodes(String userId) {
        Set<String> permissionCodes = sysRolePermissionService.getUserPermissionCodes(userId);
        return permissionCodes;
    }

    @Override
    public Set<String> getUserRoles(String userId) {
        Set<String> userRoleSigns = sysUserRoleService.getUserRoleSigns(userId);
        return userRoleSigns;
    }
}
